fix(ui): redirect to /blog when post not found in Edit page (#307)#308
fix(ui): redirect to /blog when post not found in Edit page (#307)#308mpaulosky wants to merge 1 commit into
Conversation
…t test - Edit.razor: null-value branch now navigates to /blog instead of leaving _model null (which caused infinite 'Loading...' state) - EditAclTests: added EditRedirectsToBlogWhenPostNotFound covering the Result.Ok(null) path Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🏗️ PR Added to Squad Triage QueueThis PR has been labeled with Next steps:
|
There was a problem hiding this comment.
Pull request overview
Fixes a UX bug in the blog post Edit page where a missing post (Result.Ok(null)) could leave the UI stuck in the “Loading...” state by redirecting to /blog instead, and adds a bUnit regression test to cover that path.
Changes:
- Redirect to
/blogwhenGetBlogPostByIdQuerysucceeds but returns a null post inEdit.razor. - Add bUnit test
EditRedirectsToBlogWhenPostNotFoundto validate the redirect behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Web/Features/BlogPosts/Edit/Edit.razor |
Redirects away from the Edit page when the requested post is not found. |
tests/Web.Tests.Bunit/Features/EditAclTests.cs |
Adds coverage for the “success-but-null post” redirect case. |
| else | ||
| { | ||
| _model = null; | ||
| Navigation.NavigateTo("/blog"); | ||
| return; | ||
| } |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #308 +/- ##
==========================================
+ Coverage 83.33% 83.50% +0.17%
==========================================
Files 47 47
Lines 1248 1249 +1
Branches 152 152
==========================================
+ Hits 1040 1043 +3
+ Misses 148 147 -1
+ Partials 60 59 -1
🚀 New features to boost your workflow:
|
Triage Decision: SUPERSEDED — Close as DuplicateStatus: Analysis:
Recommendation: |
|
Closing as a duplicate of #306 per triage. |
Summary
Fixes a bug where
Edit.razorwould show an infinite 'Loading...' spinner when the requested blog post does not exist.Root Cause
GetBlogPostByIdQueryreturnsResult.Ok<BlogPostDto?>(null)when a post is not found (success with null value). TheOnParametersSetAsynchandler set_model = nullin this path and left_erroras null. The template's@if (_model is null && _error is null)then rendered 'Loading...' indefinitely.This was identified in the Copilot review of PR #304 but missed before merge.
Changes
Edit.razor: null-value branch now callsNavigation.NavigateTo("/blog")and returns, consistent with the non-owner/non-admin redirectEditAclTests.cs: addedEditRedirectsToBlogWhenPostNotFoundbUnit test coveringResult.Ok(null)pathTests
Closes #307